package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVO1;
import cn.tedu._04mybatis.pojo.vo.CommentVO2;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CommentMapper {
    @Insert("insert into comment(content,created,user_id,weibo_id) values(#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);

    @Delete("delete from comment where id = #{wid}")
    int deleteComment(Long wid);

    @Update("update comment set id = #{id},content = #{content},created = #{created},user_id = #{userId},weibo_id = #{weiboId} where id = #{id}")
    int updateComment(Comment comment);

    @Select("select content,user_id userId,weibo_id weiboId from comment where id = #{id}")
    CommentVO1 selectCommentById1(Long wid);

    @Select("select content,user_id userId from comment where weibo_id = #{wbId}")
    java.util.List<CommentVO2> selectCommentById2(Long wbId);
}
